; TODO: 重写

#Include DrawBase.ahk

class DrawText extends DrawBase {

  color := '0x00AAEE'

  UpdateParam(color) {
    this.color := color
  }

  EndDraw(*) {
    return this['param']
  }

  Draw(overlay, pos, *) {
    super.Draw(overlay, pos)
    g := Gui('-Caption +AlwaysOnTop +ToolWindow +Border +Owner' overlay.hwnd)
    g.MarginX := g.MarginY := 10, g.BackColor := '000000'
    g.SetFont('s18', 'consolas')
    e := g.AddEdit('w200 h30 -E0x200 Background000000 c' (this.color & 0xFFFFFF))
    MouseGetPos(&x, &y), g.Show('x' x ' y' y)
    g.AddText('x0 y0 w220 h50').OnEvent('Click', (*) => PostMessage(0xA1, 2, , , g))

    KeyWait('enter', 'D')
    g.GetPos(&gx, &gy)
    str := e.Text
    g.Destroy()
    this.param := [str, gx + 12, gy + 12, 22, this.color, 'consolas', 'aMid aLeft w200 h30']
    overlay.drawtext(this.param*)
  }

  static Render(overlay, data, *) {
    overlay.drawtext(data*)
  }

}